package com.syp.test.clustercacheflush.util.zkflushcache;

import com.syp.test.clustercacheflush.service.SettingsService;

public enum CacheTypeEnum {

	SETTINGS(1, SettingsService.class);

	/**
	 * 类型
	 */
	private int type;
	/**
	 *  刷新缓存处理器
	 */
	private Class<? extends CacheFlushDispacher> dispacher;

	private CacheTypeEnum(int type, Class<? extends CacheFlushDispacher> dispacher) {
		this.type = type;
		this.dispacher = dispacher;
	}

	public int getType() {
		return type;
	}

	public Class<? extends CacheFlushDispacher> getDispacher() {
		return dispacher;
	}

	public static CacheTypeEnum get(int type) {
		for (CacheTypeEnum cacheType : CacheTypeEnum.values()) {
			if (cacheType.getType() == type) {
				return cacheType;
			}
		}
		return null;
	}

}
